package com.luo.chengrui.module.crbpm.dal.mysql.flowable;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import com.luo.chengrui.module.crbpm.dal.dataobject.flowable.ActReModelDO;
import org.apache.ibatis.annotations.Mapper;
import com.luo.chengrui.module.crbpm.controller.admin.flowable.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 流程模型 Mapper
 *
 * @author luodz
 */
@Mapper
public interface ActReModelMapper extends BaseMapperX<ActReModelDO> {

    default PageResult<ActReModelDO> selectPage(ActReModelPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ActReModelDO>()
                .eqIfPresent(ActReModelDO::getRev, reqVO.getRev())
                .likeIfPresent(ActReModelDO::getName, reqVO.getName())
                .eqIfPresent(ActReModelDO::getKey, reqVO.getKey())
                .eqIfPresent(ActReModelDO::getCategory, reqVO.getCategory())
                .betweenIfPresent(ActReModelDO::getLastUpdateTime, reqVO.getLastUpdateTime())
                .eqIfPresent(ActReModelDO::getVersion, reqVO.getVersion())
                .eqIfPresent(ActReModelDO::getMetaInfo, reqVO.getMetaInfo())
                .eqIfPresent(ActReModelDO::getDeploymentId, reqVO.getDeploymentId())
                .eqIfPresent(ActReModelDO::getEditorSourceValueId, reqVO.getEditorSourceValueId())
                .eqIfPresent(ActReModelDO::getEditorSourceExtraValueId, reqVO.getEditorSourceExtraValueId())
                .orderByDesc(ActReModelDO::getId));
    }

    default List<ActReModelDO> selectList(ActReModelExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ActReModelDO>()
                .eqIfPresent(ActReModelDO::getRev, reqVO.getRev())
                .likeIfPresent(ActReModelDO::getName, reqVO.getName())
                .eqIfPresent(ActReModelDO::getKey, reqVO.getKey())
                .eqIfPresent(ActReModelDO::getCategory, reqVO.getCategory())
                .betweenIfPresent(ActReModelDO::getLastUpdateTime, reqVO.getLastUpdateTime())
                .eqIfPresent(ActReModelDO::getVersion, reqVO.getVersion())
                .eqIfPresent(ActReModelDO::getMetaInfo, reqVO.getMetaInfo())
                .eqIfPresent(ActReModelDO::getDeploymentId, reqVO.getDeploymentId())
                .eqIfPresent(ActReModelDO::getEditorSourceValueId, reqVO.getEditorSourceValueId())
                .eqIfPresent(ActReModelDO::getEditorSourceExtraValueId, reqVO.getEditorSourceExtraValueId())
                .orderByDesc(ActReModelDO::getId));
    }

    List<ActReModelDO> selectBatchIds2(@Param("ids") Collection<String> ids);
}
